package com.woniu.controller;

import com.woniu.pojo.Student;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Api(tags = "zhzhzhhzhzhzhzhh")
@RestController
@RequestMapping("member")
@Slf4j
public class MemberController {

    @Autowired
    private Student student;

    @GetMapping("/{mid}")
    public String getMemberById(@PathVariable Integer mid){

        log.info("传过来的吗mid:",mid);

        return "会员id是："+mid;
    }

    @PutMapping("/{mid}")
    public Student updateStuNameByAge(@PathVariable Integer mid,@RequestBody Student student){
        log.info("stu的id："+mid);
        log.info("stu的年龄："+student.getAge());
        log.info("stu的姓名："+student.getName());

        return student;
    }

    @PostMapping("/{mid}")
    public Student insertStuNameByAge(@PathVariable Integer mid,@RequestBody Student student){
        log.info("stu的id："+mid);
        log.info("stu的年龄："+student.getAge());
        log.info("stu的姓名："+student.getName());

        return student;
    }

    @DeleteMapping("/{mid}")
    public boolean deleteStuNameByAge(@PathVariable Integer mid){
        log.info("删除了id为："+mid+"的学生");

        return true;
    }
}
